import Vue from 'vue'
import Router from 'vue-router'
import Login  from '../components/Login/login.vue'
import Index  from "../components/Product/index.vue"
import Home   from "../components/Product/components/home.vue"
import Users  from "../components/Users/Users.vue"
import Comm   from "../components/Product/components/commodity.vue"
import Commdetail   from "../components/commodity/commdetail.vue"
import Addcom   from "../components/commodity/Addcomm.vue"
import Cate from '../components/Product/components/category.vue'
import CateItem from "../components/cate/cateitem.vue"
import AddCate from "../components/cate/addCate.vue"
import Updata from "../components/commodity/updata.vue"
import Order from "../components/Product/components/order.vue"
import OrderDetail from "../components/order/orderdetail.vue"
import Echarts from "../components/comm/echarts.vue"
import Echart from "../components/comm/echart.vue"



Vue.use(Router)

export default new Router({
  mode:"history",
  routes: [
    {
      path:"/",
      redirect:'/product/index'
    },
    {
      path:'/product/index',
      name:'Index',
      component:Index,
      meta:{
        title:"首页",
        requireAuth:true
      },
      children:[
        {
          path:'/',
          name:'home',
          component:Home,
          meta:{
            title:"首页",
            requireAuth:true
          }
        },
        {
          path:'/product/index/users',
          name:'users',
          component:Users,
          meta:{
            title:"用户管理",
            requireAuth:true
          }
        },
        {
          path: '/product/index/comm',
          name: 'comm',
          component: Comm,
          meta:{
            title:"商品管理",
            requireAuth:true
          },
        },
        {
          path: '/product/index/detail/:id',  //动态路由传参  :id
          name: 'detail',
          component: Commdetail,
          meta:{
            title:"商品详情",
            requireAuth:true
          },
        },
        {
          path: '/product/index/addcom',
          name: 'addcom',
          component: Addcom,
          meta:{
            title:"添加商品",
            requireAuth:true
          },
        },
        {
          path: '/product/index/updata',
          name: 'updata',
          component: Updata,
          meta:{
            title:"商品编辑",
            requireAuth:true
          },
        },
        {
          path: '/product/index/cate',
          name: 'cate',
          component: Cate,
          meta:{
            title:"品类管理",
            requireAuth:true
          },
        },
        {
          path: '/product/index/cateItem',
          name: 'cateItem',
          component: CateItem,
          meta:{
            title:"品类管理",
            requireAuth:true
          },
        }, 
        {
          path: '/product/index/addcate',
          name: 'addcate',
          component: AddCate,
          meta:{
            title:"添加品类",
            requireAuth:true
          },
        }, 
        {
          path: '/product/index/order',
          name: 'order',
          component: Order,
          meta:{
            title:"订单管理",
            requireAuth:true
          },
        }, 
        {
          path: '/product/index/orderdetail',
          name: 'orderdetail',
          component: OrderDetail,
          meta:{
            title:"订单详情",
            requireAuth:true
          },
        }, 
        {
          path: '/product/index/echarts',
          name: 'echarts',
          component: Echarts,
          meta:{
            title:"echarts图表",
            requireAuth:true
          },
        }, 
        {
          path: '/product/index/echart',
          name: 'echart',
          component: Echart,
          meta:{
            title:"echarts图表数据展示",
            requireAuth:true
          },
        }, 
      ]
    },
    {
      path:"/login",
      name:'login',
      component:Login,
      meta:{
        title:"登录"
      }
    },
     
  ]
})
